package cn.xiaobai.controller;

import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import cn.xiaobai.R;
import cn.xiaobai.domain.Event;
import cn.xiaobai.listener.AbstractEventListener;
import cn.xiaobai.listener.ClickedListener;

/**
 * @Author yangdaji
 * @Date 2023/12/23
 * @PackageName cn.xiaobai
 * @ClassName MainApplication
 */
public class MainApplication extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // 注册事件
        regisListener();
    }

    private void regisListener() {
        // 查找按钮对象
        Button loginBt = findViewById(R.id.login_bt);
        Button regisBt = findViewById(R.id.regis_bt);
        EditText username = findViewById(R.id.username_edit);
        EditText password = findViewById(R.id.password_edit);


        Event event = new Event(loginBt, regisBt, username, password);

        // 绑定点击事件
        AbstractEventListener.addOnClickListener(event, new ClickedListener(this));

    }
}
